import axios from "axios"

const http = axios.create({
  baseURL: "https://api.it120.cc",
  timeout: 5000,
})

http.interceptors.request.use(
  (config) => {
    if (localStorage.getItem("token")) {
      config.headers.token = localStorage.getItem("token")
    }
    return config
  },
  (err) => {
    console.log(err)
  }
)
http.interceptors.response.use(
  (res) => {
    return res
  },
  (err) => {
    console.log(err)
  }
)
export default http
